package com.wuchao.convert.exception;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author WuChao
 * @version 1.0
 * @date 2020/4/3 12:54
 */
@ControllerAdvice
public class GlobalExceptionResolver {
    /**
     * 处理所有不可知异常
     *
     * @param e 异常
     * @return json结果
     */
    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Result handleException(Exception e) {
        // 打印异常堆栈信息

        return  new Result(e.getMessage(), 01111);
    }




}
